<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <!-- 使⽤ JS 正则表达式，测试⼀段字符串的第⼀个字符是否为⼤写。  -->
</head>
<body>
  <script>
    var str = prompt('请输入字符');
    if((/[A-Z][A-Za-z0-9]*/).test(str)){
      alert(true);
    }else{
      alert(false)
    }
  </script>
</body>
</html>